package ray.mgocc;

import java.util.Map;
import java.util.Properties;
import java.util.Collection;
import java.util.List;
import java.util.ArrayList;

public class Rules extends Properties{
    private final static Rules instance = new Rules();
    private Rules(){
        init();
    }
    private void init(){
        clear();
        setProperty("DM","Deathmatch");
        setProperty("SDM","Stealth Deathmatch");
        setProperty("SCAP","Solo Capture");
        setProperty("TDM","Team Deathmatch");
        setProperty("CAP","Capture Mission");
        setProperty("BASE","Base Mission");
        setProperty("BOMB","Bomb Mission");
        setProperty("RACE","Race Mission");
        setProperty("RES","Rescue Mission");
        setProperty("TSNE","Team Sneaking");
        setProperty("SNE","Sneaking Mission");
    }
    /**
     * 逆引き。long nameからshort nameを調べる。
     */
    public static String getShortName(String longName){
        String hit = null;
        for(Map.Entry entry:instance.entrySet()){
            String value = (String)entry.getValue();
            if(value.equals(longName)){
                hit = (String)entry.getKey();
            }
        }
        return hit;
    }
    /**
     * 正引き。short nameからlong nameを調べる。
     */
    public static String getName(String shortName){
        return instance.getProperty(shortName);
    }
    public static List<String> getList(){
        List<String> list = new ArrayList<String>();
        for(Object rule:instance.values()){
            list.add((String)rule);
        }
        return list;
    }
}
